﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Xml.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using CarBooker.Controllers;
using System.Drawing;


namespace CarBooker.Models
{
    public class BookingRequest
    {
        [Required]
        [DisplayName("Start Date")]
        public DateTime StartDate { get; set; }

        [Required]
        [DisplayName("End Date")]
        public DateTime EndDate { get; set; }

        [Required]
        [DisplayName("Location")]
        public string Location {get; set;}

        public BookingRequest()
        {
            StartDate = DateTime.Today;
            EndDate = DateTime.Today;
            Location = "London SW1";
        }
        public BookingRequest(DateTime startDate, DateTime endDate, string location)
        {
            StartDate = startDate;
            EndDate = endDate;
            Location = location;
        }

        public List<Car> FindAvailableCars(CarRepository cars)
        {
            return cars.Cars;
        }
    }

    public partial class Booking
    {
        static uint prevID;

        public Booking(BookingRequest request)
        {
            Request = request;
            BookingID = prevID + 1;
            prevID = BookingID;
        }
    }

    public partial class BookedCar
    {
        static uint prevID;

        public BookedCar(uint bookingID, uint carID, uint customerID)
        {
            BookingID = bookingID;
            CarID = carID;
            CustomerID = customerID;
            BookedCarID = prevID + 1;
            prevID = BookedCarID;
        }
    }
}